import {createRouter, createWebHashHistory, createWebHistory} from 'vue-router';

const routes = [
    {path: '/game', component: () => import("./views/onlineIndex.vue")},
    {
        path: '/',
        //redirect: '/index',
        component: () => import("./views/onlineIndex.vue"),
        // children: [
        //
        //     {
        //         path: '/index', component: () => import("./views/index.vue"),
        //         meta: {
        //             keepAlive: true
        //         }
        //     },
        //     {
        //         path: '/online/:params', component: () => import("./views/online.vue"),
        //
        //     },
        //     {
        //         path: '/my',
        //         component: () => import("./views/my.vue"),
        //
        //     },
        //
        // ]

    },
    {
        path: "/item/:id",
        meta: {
            keepAlive: false
        },

        component: () => import("./views/item.vue")
    },

    {
        path: '/manage',
        component: () => import("./views/manage.vue"),

    },

    {
        path: '/record',
        component: () => import("./views/code.vue"),

    },
       {
        path: '/score',
        component: () => import("./views/change.vue"),

    },
    {
        path: '/member',
        component: () => import("./views/change.vue"),

    },

     {
        path: '/search',
        component: () => import("./views/search.vue"),

    },
    {
        path: '/login',
        component: () => import("./views/login.vue"),

    },

    {
        path: '/logs/:account',
        component: () => import("./views/logs.vue"),
    },
     {
        path: '/swiper/:url',
        component: () => import("./views/content.vue"),
    }

];

const router = createRouter({
    history: createWebHashHistory('/'),
    routes,
});
// router.beforeEach((to, from, next) => {
//     var QQ = localStorage.getItem('qq');
//
//     if (to.path == '/index'||to.path == '/login') {
//         next()
//     } else if(QQ!=undefined||QQ!=null){
//         next()
//     }
//     next("/login")
// })
export default router;